{% extends "templates/base.phtml" %}
{% block content %}
{% if cu['role_id'] ==1 %}
                    <!-- START WIDGETS -->
                    <div class="row">
                        <div class="col-md-4">
                            
                            <!-- START WIDGET MESSAGES -->
                            <div class="widget widget-default widget-item-icon" onclick="location.href='/admin/user';">
                                <div class="widget-item-left">
                                    <span class="fa  fa-sitemap"></span>
                                </div>                             
                                <div class="widget-data">
                                    <div class="widget-int num-count">{{agent_count}}</div>
                                    <div class="widget-title">总代理数</div>
                                </div>      
                            </div>                            
                            <!-- END WIDGET MESSAGES -->
                            
                        </div>
                        <div class="col-md-4">
                            
                            <!-- START WIDGET REGISTRED -->
                            <div class="widget widget-default widget-item-icon" onclick="location.href='/admin/user';">
                                <div class="widget-item-left">
                                    <span class="fa fa-user"></span>
                                </div>
                                <div class="widget-data">
                                    <div class="widget-int num-count">{{user_count}}</div>
                                    <div class="widget-title">总用户数</div>
                                </div>                         
                            </div>                            
                            <!-- END WIDGET REGISTRED -->
                            
                        </div>
                        <div class="col-md-4">
                            
                            <!-- START WIDGET CLOCK -->
                            <div class="widget widget-danger widget-padding-sm">
                                <div class="widget-big-int plugin-clock">00:00</div>                            
                                <div class="widget-subtitle plugin-date">Loading...</div>                        
                                <div class="widget-buttons widget-c3">
                                    <div class="col">
                                        <a href="/admin/role"><span class="fa fa-code-fork"></span></a>
                                    </div>
                                    <div class="col">
                                        <a href="/admin/user"><span class="fa fa fa-user"></span></a>
                                    </div>
                                    <div class="col">
                                        <a href="/admin/setting"><span class="fa fa-gears"></span></a>
                                    </div>
                                </div>                            
                            </div>                        
                            <!-- END WIDGET CLOCK -->
                            
                        </div>
                    </div>
{% elseif cu['role_id'] ==2 %}
<!-- START WIDGETS -->
<div class="row">
    <div class="col-md-4">
        <!-- START WIDGET MESSAGES -->
        <div class="widget widget-success widget-item-icon" onclick="location.href='/admin/user';">
            <div class="widget-item-left">
                <span class="fa fa-users"></span>
            </div>
            <div class="widget-data">
                <div class="widget-int num-count">{%if Cuser_count==""%}0{%else%}{{Cuser_count}}{%endif%}</div>
                <div class="widget-title">发展用户数</div>
            </div>
        </div>
        <!-- END WIDGET MESSAGES -->

    </div>
    <div class="col-md-4">
        <!-- START WIDGET REGISTRED -->
        <div class="widget widget-primary widget-item-icon" onclick="location.href='/admin/flow';">
            <div class="widget-item-left">
                <span class="fa fa-credit-card"></span>
            </div>
            <div class="widget-data">
                <div class="widget-int num-count">{%if flow_sum==""%}0{%else%}{{flow_sum}}{%endif%}</div>
                <div class="widget-title">总流水</div>
            </div>
        </div>
        <!-- END WIDGET REGISTRED -->

    </div>
    <div class="col-md-4">
        <!-- START WIDGET REGISTRED -->
        <div class="widget widget-default widget-item-icon" onclick="location.href='/admin/flow/index/today';">
            <div class="widget-item-left">
                <span class="fa fa-dollar"></span>
            </div>
            <div class="widget-data">
                <div class="widget-int num-count">{%if today_sum==""%}0{%else%}{{today_sum}}{%endif%}</div>
                <div class="widget-title">今日流水</div>
            </div>
        </div>
        <!-- END WIDGET REGISTRED -->

    </div>
</div>

<div class="row">
    <div class="col-md-12">
        <h5 class="pull-right flow-help" data-toggle="modal" data-target="#myModal">帮&nbsp;助？</h5>
        <!-- Modal -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel">帮助</h4>
                    </div>
                    <div class="modal-body">
                        <div class="user">
                            <h4>啥是"发展用户数"？</h4>
                            <p>发展用户数发展用户数发展用户数发展用户数发展用户数发展用户数发展用户数发展用户数发展用户数发展用户数发展用户数</p>
                        </div>
                        <div class="all_flow">
                            <h4>啥是"总流水"？</h4>
                            <p>总流水总流水总流水总流水总流水总流水总流水总流水总流水总流水</p>
                        </div>
                        <div class="today_flow">
                            <h4>啥是"今日流水"？</h4>
                            <p>今日流水今日流水今日流水今日流水今日流今日流水今日流水今日流水今日流水
                                今日流水今日流水今日流水今日流水今日流水今日流水水今日流水今日流水今日流水</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% else %}
    <div class="row">
        <div class="col-md-4">
            <div class="panel panel-info">
                <div class="panel-body">
                    <p><label>我的应用：&nbsp;</label>{{myappcount}}<span>个</span></p>
                    <p><label>我的积分：&nbsp;</label>{{Cuser['sum']}}<span>分</span></p>
                    <div class="about-app-list user">
                        <img src="/assets/images/users/update.jpg" alt="Nadia Ali"/>
                        <a class="name">应用升级提示</a>
                        <div class="pull-right" style="width: 100px;">
                            <a href="http://www.i-yizu.com" class="btn btn-info btn-block">查看</a>
                        </div>
                    </div>
                    <div class="about-app-list user">
                        <img src="/assets/images/users/new.jpg" alt="Nadia Ali"/>
                        <a class="name">最新推出应用</a>
                        <div class="pull-right" style="width: 100px;">
                            <a href="http://www.i-yizu.com" class="btn btn-info btn-block">查看</a>
                        </div>
                    </div>
                </div>
                <div class="panel-footer">
                    <label class="footer-lab">关于应用</label>
                    <a class="btn btn-success pull-right" href="/admin/app/">进入</a>
                </div>
            </div>
            <!-- END SUCCESS PANEL -->
        </div>

        <div class="col-md-4">
            <!-- START SUCCESS PANEL -->
            <div class="panel panel-info">
                <div class="panel-body">
                    <ul>
                        <li style="line-height: 22px;"><a href="http://www.i-yizu.com">史上最不靠谱交流会...</a><span class="pull-right">2015-1-16</span></li>
                        <li style="line-height: 22px;"><a href="http://www.i-yizu.com">i逸站平台开发内测......</a><span class="pull-right">2015-1-16</span></li>
                        <li style="line-height: 22px;"><a href="http://www.i-yizu.com">IVO年会......</a><span class="pull-right">2015-1-16</span></li>
                        <li style="line-height: 22px;"><a href="http://www.i-yizu.com">i逸站平台需求研讨会......</a><span class="pull-right">2015-1-16</span></li>
                        <li style="line-height: 22px;"><a href="http://www.i-yizu.com">NPC服务体系成立......</a><span class="pull-right">2015-1-16</span></li>
                        <li style="line-height: 22px;"><a href="http://www.i-yizu.com">i逸站产品启动......</a><span class="pull-right">2015-1-16</span></li>
                        <li style="line-height: 22px;"><a href="http://www.i-yizu.com">爱逸族下沙地方门户庆功会......</a><span class="pull-right">2015-1-16</span></li>
                    </ul>
                </div>
                <div class="panel-footer">
                    <label class="footer-lab">最新资讯</label>
                    <button class="btn btn-success pull-right">查看更多</button>
                </div>
            </div>
            <!-- END SUCCESS PANEL -->
        </div>
        <div class="col-md-4">
            <!-- START SUCCESS PANEL -->
            <div class="panel panel-info">
                <div class="panel-body">
                    <div class="form-horizontal" role="form">
                        <div class="user-info-penal form-group">
                            <label class="col-md-4 control-label">账号名称：&nbsp;</label>
                            <p class="col-md-8">{{Cuser['username']}}</p>
                        </div>
                        <div class="user-info-penal form-group">
                            <label class="col-md-4 control-label">账号类型:&nbsp;</label>
                            <p class="col-md-8">{{role.title}}</p>
                        </div>
<!--                        <div class="user-info-penal form-group">-->
<!--                            <label class="col-md-4 control-label">账号有效期:&nbsp;</label>-->
<!--                            <p class="col-md-8">2014.4.10 - 2015.1.16</p>-->
<!--                        </div>-->
                        <div class="user-info-penal form-group">
                            <label class="col-md-4 control-label">是否认证:&nbsp;</label>
                            <p class="col-md-8">2014.4.10 - 2015.1.16</p>
                        </div>
                        <div class="user-info-penal form-group">
                            <label class="col-md-4 control-label">微信支付:&nbsp;</label>
                            <p class="col-md-8">已开通</p>
                        </div>
                    </div>
                </div>
                <div class="panel-footer">
                    <label class="footer-lab">账号信息</label>
                    <button class="btn btn-success pull-right">设置</button>
                </div>
            </div>
            <!-- END SUCCESS PANEL -->
        </div>
    </div>

    <div class="row" style="height: auto; position: relative;">
        {% for userapp in appuser %}
        {%if userapp.getApp().out==0 %}
        <div class="J-dashbord" data-name="{{userapp.getApp().action}}">

        </div>
        {%endif%}
        {% endfor %}
    </div>





{% endif %}
{% endblock%}

{% block end%}
<style type="text/css">
    .flow-help{
        color:#E34724;
        font-weight: 800;
        font-size: 14px;
        cursor: pointer;
        margin-right: 30px;
    }
</style>
<style type="text/css">
    .footer-lab{
        font-size: 16px;
        font-weight: 400;
        line-height: 30px;
        color: #434a54;
    }
    .user-info-penal p{
        padding-top: 0.25em;
    }
</style>
<script type="application/javascript">
    $(document).ready(function() {
        $('.J-dashbord').each(function(){
            var that=this;
            var url=$(this).data('name');
            url='/admin/app'+url+'/dashboard';
            $.get(url, function(data) {
                $(that).html(data);
                $(window).resize();
            },'html');
        })
    });
</script>
{%endblock%}